package com.example.project.controller;

import com.example.project.entity.Job;
import com.example.project.service.IJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 作者：金照富
 * 2023年10月29日23点44分
 */
@RestController
@Api
public class JobController {
    @Autowired
    private IJobService jobService;

    @ApiOperation(value = "添加职务类型",
            notes = "成功返回1")
    @RequestMapping("/insertJob")
    public int insertJob(Job job){
        return jobService.insertJob(job);
    }

    @ApiOperation(value = "删除职务类型",
            notes = "成功返回1")
    @RequestMapping("/deleteJob")
    public int deleteJob(int id){
        Job job=new Job();
        job.setJobId(id);
        return jobService.deleteJob(job);
    }

    @ApiOperation(value = "修改职务类型信息",
            notes = "成功返回1")
    @RequestMapping("/updateJob")
    public int updateJob(Job job){
        return jobService.updateJob(job);
    }

    @ApiOperation(value = "查询所有职务类型信息",
            notes = "成功返回Json")
    @RequestMapping("/getAllJob")
    public List<Job> getAllJob(String name){
        Job job=new Job();
        job.setJobName(name);
        return jobService.getAllJob(job);
    }

    @ApiOperation(value = "查询职务类型信息",
            notes = "成功返回Json")
    @RequestMapping("/getJob")
    public Job getJob(String name){
        Job job=new Job();
        job.setJobName(name);
        return jobService.getJob(job);
    }
}
